package com.zx.cloud.util;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;

import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeHandler;

public class TimestampTypeHandler implements TypeHandler<Timestamp> {

	@Override
	public void setParameter(PreparedStatement ps, int i, Timestamp parameter, JdbcType jdbcType) throws SQLException {
		ps.setTimestamp(i, parameter);
	}

	@Override
	public Timestamp getResult(ResultSet arg0, int columnName) throws SQLException {
		Timestamp ts = arg0.getTimestamp(columnName);
		return ts;
	}

	@Override
	public Timestamp getResult(ResultSet arg0, String columnName) throws SQLException {
		Timestamp ts = arg0.getTimestamp(columnName);
		return ts;
	}

	@Override
	public Timestamp getResult(CallableStatement arg0, int arg1) throws SQLException {
		Timestamp ts = arg0.getTimestamp(arg1);
		return ts;
	}

}